# RUN: llc -mtriple=aarch64 -run-pass=patchable-function %s -o - | FileCheck %s

## The initial .loc covers PATCHABLE_FUNCTION_ENTER.
## Emitting a new .loc may create a prologue_end prematurely.
# CHECK:    name: empty
# CHECK:    bb.0.entry
# CHECK:      PATCHABLE_FUNCTION_ENTER{{$}}
# CHECK-NEXT: RET undef $lr, debug-location !9

--- |
  define void @empty() #0 !dbg !6 {
  entry:
    ret void, !dbg !9
  }

  attributes #0 = { "patchable-function-entry"="1" }
  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
  !1 = !DIFile(filename: "a.c", directory: "/tmp")
  !2 = !{}
  !3 = !{i32 7, !"Dwarf Version", i32 4}
  !4 = !{i32 2, !"Debug Info Version", i32 3}
  !5 = !{i32 1, !"wchar_size", i32 4}
  !6 = distinct !DISubprogram(name: "empty", scope: !1, file: !1, line: 1, type: !7, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
  !7 = !DISubroutineType(types: !8)
  !8 = !{null}
  !9 = !DILocation(line: 1, column: 61, scope: !6)
  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!3, !4, !5}

...
---
name:            empty
alignment:       4
tracksRegLiveness: true
body:             |
  bb.0.entry:
    liveins: $lr
    RET undef $lr, debug-location !9

...
